package edu.tapestry.iddb.client.helpers;

import iddb.ImUserPOJO;

public class IMIdentificator {

	String username;
	String type;
	String srvAddr;
	
	static String SEPARATOR = ";@";
	
	public IMIdentificator(String str){
		String[] params = str.split(SEPARATOR);
		int i = 0;
		this.username = params[i];
		i++;
		this.type = params[i];
		i++;
		this.srvAddr = params[i];
	}
	
	public IMIdentificator(String username, String type, String srvAddr) {
		super();
		this.username = username;
		this.type = type;
		this.srvAddr = srvAddr;
	}
	
	public IMIdentificator(ImUserPOJO imuser){
		this.srvAddr = imuser.getSrvAddr();
		this.type = imuser.getImType();
		this.username = imuser.getUsername();
	}
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getSrvAddr() {
		return srvAddr;
	}
	public void setSrvAddr(String srvAddr) {
		this.srvAddr = srvAddr;
	}
	
	public String toString(){
		StringBuffer sb = new StringBuffer();
		
		sb.append(this.username);
		sb.append(SEPARATOR);
		sb.append(this.type);
		sb.append(SEPARATOR);
		sb.append(this.srvAddr);
		
		
		return sb.toString();
	}
	
	
}
